package com.learn.mvp.model;

import android.os.Handler;
import android.util.Log;

import com.learn.mvp.presenter.ILoginPresenter;

public class LoginModel implements ILoginModel{

    private ILoginPresenter presenter;

    private Handler mHandler = new Handler();

    public LoginModel(ILoginPresenter presenter) {
        this.presenter = presenter;

    }

    @Override
    public void login(final String name , final String password) {
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                Log.d("LoginModel", "run: ");
                if("admin".equals(name) && "admin".equals(password)){
                    presenter.loginSucceed();
                }else {
                    presenter.loginFailed();
                }
            }
        },1000);
    }

}
